#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "../umlcore/PartialElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class ConnectableElement;
class Connector;
class Property;

/// <summary>
/// StructuredClassifier
/// StructuredClassifiers may contain an internal structure of connected elements
/// each of which plays a role in the overall Behavior modeled by the
/// StructuredClassifier.
/// </summary>
class UMLMODEL_EXPORT StructuredClassifier : public PartialElement {

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Methods
    /// <summary>
    /// allRoles
    /// All features of type ConnectableElement, equivalent to all direct and inherited
    /// roles.
    /// </summary>
    virtual shared_ptr<vector<ConnectableElement>> allRoles() const;

public: // Properties
    /// <summary>
    /// ownedAttributes getter
    /// The Properties owned by the StructuredClassifier.
    /// </summary>
    vector<shared_ptr<Property>>& ownedAttributes();

    /// <summary>
    /// ownedConnectors getter
    /// The connectors owned by the StructuredClassifier.
    /// </summary>
    vector<shared_ptr<Connector>>& ownedConnectors();

    /// <summary>
    /// parts getter
    /// The Properties specifying instances that the StructuredClassifier owns by
    /// composition. This collection is derived, selecting those owned Properties where
    /// isComposite is true.
    /// </summary>
    vector<shared_ptr<Property>>& parts();

    /// <summary>
    /// roles getter
    /// The roles that instances may play in this StructuredClassifier.
    /// </summary>
    vector<shared_ptr<ConnectableElement>>& roles();

private: // Fields
    /// <summary>
    /// ownedAttributes
    /// The Properties owned by the StructuredClassifier.
    /// </summary>
    vector<shared_ptr<Property>> ownedAttributes_;

    /// <summary>
    /// ownedConnectors
    /// The connectors owned by the StructuredClassifier.
    /// </summary>
    vector<shared_ptr<Connector>> ownedConnectors_;

    /// <summary>
    /// parts
    /// The Properties specifying instances that the StructuredClassifier owns by
    /// composition. This collection is derived, selecting those owned Properties where
    /// isComposite is true.
    /// </summary>
    vector<shared_ptr<Property>> parts_;

    /// <summary>
    /// roles
    /// The roles that instances may play in this StructuredClassifier.
    /// </summary>
    vector<shared_ptr<ConnectableElement>> roles_;

};

} // namespace uml
